package edu.sctu.zcy.month201505.day20150513;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created by user24 on 2015/5/13.
 */
public class SubClassOne extends Parent {

    Person[] person;

    public SubClassOne(Person[] p) {
        super("学生信息1：");
        this.person = p;

    }

    @Override
    public List<Person> printOne() {

       List<Person> persons = new ArrayList();

        for (int i = 0;i < person.length;i++) {
            if(person[i].getScore() > 60){
                persons.add(person[i]);

            }
        }
        return persons;
    }

    public void print(InterFacePerson interFacePerson){


        List<Person> list = interFacePerson.getInfo(20);
        System.out.println("年龄大于age=20的人数="+list.size());

        Iterator one = list.iterator();
        System.out.println("年龄大于age的学生的基本信息：");

        while (one.hasNext()){

            Person person1 = (Person) one.next();

            System.out.println(person1.getName()+"  "+person1.getAge()+"  "+person1.getScore()+"  "+
            person1.getNumber()+"  "+person1.getAddress());
        }
    }
}

